Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pirates

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pirates

Properly hijack require, i.e., properly define require hooks and customizations

  • 4.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27M
decreased by-9.1%
Maintainers
3
Weekly downloads
 
Created

What is pirates?

The pirates npm package is designed to add hooks to Node.js's require function, allowing developers to modify the behavior of module loading. This can be particularly useful for tasks such as compiling code on-the-fly, implementing custom loaders, or applying transformations to module sources before they are executed.

What are pirates's main functionalities?

Adding a hook to require

This feature allows you to add a custom transformation hook to Node.js's require function for files with specific extensions. In the code sample, a hook is added for '.js' files, where you can transform the code before it's executed. The `revert` function can be called to remove the hook.

const { addHook } = require('pirates');

const revert = addHook((code, filename) => {
  // Transform the code here
  return code;
}, {
  exts: ['.js']
});

Other packages similar to pirates

FAQs

Package last updated on 20 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc